<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@page import="com.manage.grouppriv.GroupVo"%>
<%@page import="com.login.LoginVO"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
List<GroupVo> groupList = (List)request.getAttribute("groupList");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
  <title></title>
<script type="text/javascript" src="<%=path%>/js/jquery-1.9.1.min.js"></script>
<link rel='stylesheet' href='<%=path %>/manage/grouppriv/zh-cn.default.css?v=3.3' type='text/css' media='screen' />
<style>
.user{display:block; width:80px; float:left; overflow:hidden}
</style>
<script type="text/javascript">
	function showMsg(msg){
		document.getElementById('showmsg').style.display = 'block';
		document.getElementById('showmsg').innerText = msg;
		window.setTimeout("hiddenMsg()", 3000);
	}
	function hiddenMsg(){
		document.getElementById('showmsg').style.display = 'none';
		document.getElementById('showmsg').innerText = '';
	}
</script>
</head>
<body>
<style>
#colorbox, #cboxOverlay, #cboxWrapper{z-index:9999;}
</style>
<div class='outer'>
<table align='center' class='table-1 tablesorter'>
  <tr class='colhead'>
   <th class='w-id'>编号</th>
   <th class='w-100px'>分组名称</th>
   <th>分组描述</th>
   <th>用户列表</th>
   <th class='w-200px {sorter:false}'>操作</th>
  </tr>
  <%
  if(groupList != null && groupList.size() > 0){
  for(int i=0;i<groupList.size();i++){
	  GroupVo vo = groupList.get(i);
	  List<LoginVO> userList = vo.getUserList();
	  String userName = "";
	  if(userList != null && userList.size() > 0){
		  for(int j=0;j<userList.size();j++){
			  userName += "," + userList.get(j).getName();
			  if(userName.length() > 30){
				  userName += "...";
				  break;
			  }
		  }
		  userName = userName.substring(1);
	  }
  %>
  <tr class='a-center'>
    <td class='strong'><%=i+1 %></td>
    <td><%=vo.getName() %></td>
    <td class='a-center'><%=vo.getDescr() %></td>
    <td class='a-left'><%=userName %></td>
    <td>
      <a href='<%=basePath%>/manage/grouppriv/showGroupPriv.action?groupvo.id=<%=vo.getId() %>&groupvo.name=<%=com.util.Base64.encode(vo.getName().getBytes()) %>'>权限维护</a>
      <a href='<%=basePath%>/manage/grouppriv/showGroupUser.action?groupvo.id=<%=vo.getId() %>&groupvo.name=<%=com.util.Base64.encode(vo.getName().getBytes()) %>'>成员维护</a>
      <a href='<%=basePath%>/group/showGroupEdit.action?groupvo.id=<%=vo.getId() %>'>编辑</a>
      <%if(vo.getId() != 9999) {//默认组不能被删除%>
      <a href='<%=basePath%>/group/delGroup.action?groupvo.id=<%=vo.getId() %>'>删除</a>
      <%} %>
    </td>
  </tr>
  <%}} %>
</table>
</div>
<script type="text/javascript">
var msg = "${requestScope.rMsg}";
if(msg != ""){
	showMsg(msg);
}
</script>
</body>
</html>